package site.assad.basicQuartzTest;

import org.quartz.*;
import org.quartz.impl.StdSchedulerFactory;

/**
 * Author: Al-assad 余林颖
 * E-mail: yulinying_1994@outlook.com
 * Date: 2018/1/19 19:20
 * Description: 从数据库中恢复被中断的任务调度现场
 */
public class JBDCRecoverRunner {
    public static void main(String[] args) throws SchedulerException {
        SchedulerFactory schedulerFactory = new StdSchedulerFactory();
        Scheduler scheduler = schedulerFactory.getScheduler();

        //获取定位为“group1.trigger1”的 Trigger
        SimpleTrigger trigger = (SimpleTrigger) scheduler.getTrigger(TriggerKey.triggerKey("trigger1","group1"));
        //恢复运行指定的 Trigger
        scheduler.rescheduleJob(trigger.getKey(),trigger);

        scheduler.start();
    }
}
